package data_management;


public class PItem {
	private int aarrayKey;
	private PatternSet patternSet;
	private Long [] vtimeword;

	PItem(){}
	PItem(int key, PatternSet patternSet){
		aarrayKey = key;
		this.patternSet = patternSet;
		PatternUnit pt = patternSet.getPatternUnit();

		// array ·Î º¯È¯
		vtimeword = new Long[pt.size()];
		timeword(pt).toArray(vtimeword);
	}

	TimeWords timeword(PatternUnit pattern){
		TimeWords word = new TimeWords();
		if(pattern.size()%2!=0) return null;

		for(int i=0; i<pattern.size()-1; i++){
			word.add(pattern.get(i+1) - pattern.get(i));
		}
		return word;
	}

	//getter & setter
	public PatternSet       getPatternSet() { return patternSet; }
	public void             setPatternSet(PatternSet patternSet) {  this.patternSet = patternSet; }

	public Long[] getTimeword() {   return vtimeword; }
	public void setTimeword(Long[] vtimeword) {     this.vtimeword = vtimeword; }

	public int arrayKey() {return aarrayKey;}
	public void setArrayKey(int arrayKey) { this.aarrayKey = arrayKey;}
}